# -*- coding:utf-8 -*-

"""预约标

"""
from aw import *
from autotest import *


class Test_005(TestCase):

    def setUp(self):
        print("Test_001 setUp")
        Common.selectProduct("ZC201811051603334715281--会员稳盈45天")
        Common.selectTemplate()
        Common.getProducts(is_reserve=True)
        Common.getProducts(product_type=2)
        Common.getProducts(product_type=15)

        Common.selectProductRate("ZC201810271616327806101")

        #创建计划类产品
        Common.createProduct(product_Type="周增", tmpId=176, isReserve=True,raiseEndTimeStr="2018-11-29 23:59:59")
        Common.createProduct(product_Type="月增", tmpId=180, isReserve=True,raiseEndTimeStr="2018-11-29 23:59:59")
        Common.createProduct(product_Type="双月增", tmpId=177, isReserve=True,raiseEndTimeStr="2018-11-29 23:59:59")
        Common.createProduct(product_Type="季增", tmpId=181, isReserve=True,raiseEndTimeStr="2018-11-29 23:59:59")


        #创建定期产品
        Common.createProduct(prodType="dq",tmpId=26,product_term=30, isReserve=True,raiseEndTimeStr="2018-11-29 23:59:59")
        Common.createProduct(prodType="dq",tmpId=26,product_term=45, isReserve=True,raiseEndTimeStr="2018-11-29 23:59:59")
        Common.createProduct(prodType="dq",tmpId=476,product_term=180, isReserve=True,raiseEndTimeStr="2018-11-29 23:59:59")
        Common.createProduct(prodType="dq",tmpId=476,product_term=180, isReserve=True,raiseEndTimeStr="2018-11-29 23:59:59")
        Common.createProduct(prodType="dq",tmpId=477,product_term=365, isReserve=True,raiseEndTimeStr="2018-11-29 23:59:59")


        Common.dumpProduct("ZC201810231934317207970")
        Common.loadProduct("ZC201810231704586551135")

        Common.cleanCache("ZC201810271612155392959")
        Common.cleanCache("1100111023")
        Common.cleanCache("1100099819")
        Common.getProducts()
        Common.getProducts(product_type=2)
        Common.getProducts(product_type=15)

        Common.updateProduct("ZC201810271612155392959--月增1",product_name="月增1810271-1")
        Common.updateProduct("ZC201811021604048264702--稳盈30天",product_name="黄金会员月增1811021")
        Common.updateProduct("PD201811021853119517155--稳盈30天",product_name="稳赢180天1-1811021 ",product_term=180)
        Common.updateProduct("PD201811051605115961200--会员稳盈45天",product_term=45)
        Common.raiseInterest("ZC201811051603334715281")


    def test(self):
        Common.getRecordProduct(product_type=2)
        Common.getRecordProduct(product_type=15)


        zou_zeng = ["ZC201811051450598505790--周增"]
        for pno in zou_zeng:
            Common.updateProduct(pno, raise_start_time="2018-11-06 20:45:58")
            Common.updateProduct("ZC201811021835047727276", product_status=5, raise_end_time="2018-11-30 19:44:59", )


        yue_zeng = ["ZC201811021604048264702--月增1","ZC201811021832090309643--月增2",]

        # for pno in yue_zeng:
        #     Common.updateProduct("ZC201810271612369903395--月增2", raise_start_time="2018-11-02 20:45:58")
        Common.updateProduct("ZC201811051612372899803", product_status=5, raise_start_time="2018-11-22 19:44:59", ) # 恢复这个
        #     Common.raiseInterest("ZC201810271612369903395--月增2", interest=0.01)
        #     Common.raiseInterest("ZC201810271612155392959--月增1",interest=0.01)

        shuang_yue_zeng = ["ZC201811021834341578717--双月增"]

        # for pno in shuang_yue_zeng:
        #     Common.updateProduct("ZC201810271616441952424--双月增", raise_start_time="2018-11-02 20:45:58")
        #     Common.updateProduct("ZC201811021226075612539", product_status=6, raise_end_time="2018-10-22 19:44:59", )
        #     Common.updateProduct(pno, raise_start_time="2018-10-28 20:45:58")


        ji_zeng = ["ZC201811021835047727276--季增"]
        # for pno in ji_zeng:
        #     Common.updateProduct(pno, product_status=6, raise_end_time="2018-10-22 19:44:59", )
        #     Common.updateProduct(pno, raise_start_time="2018-10-28 20:45:58")


        # 稳赢 依次是30天 45天 180天 365天
        wen_yin = ["PD201811021836319447203--稳盈30天",
                   "PD201811021852365833709--稳盈45天",
                   "PD201811021853119517155--稳盈180天1"
                   "PD201811021853258996436--稳盈180天2",
                   "PD201811021853398797070---稳盈365天"]

        for pno in zou_zeng+yue_zeng+shuang_yue_zeng+ji_zeng+wen_yin:
            Common.updateProduct(pno, product_status=5,raise_end_time="2018-11-22 19:44:59", )
            Common.dumpProduct(pno)
            Common.dumpProduct("PD201811021537011796814--稳盈180天2")

        #       Common.loadProduct(pno)
            Common.updateProduct(pno,product_status=5,raise_start_time="2018-10-26 20:45:58",raise_end_time="2018-11-22 19:44:59",)

        Common.updateProduct("PD201810251206073759300", raise_start_time="2018-10-28 20:45:58")
        Common.updateProduct("PD201811021853258996436--会员稳盈45天", product_status=6, raise_end_time="2018-10-22 19:44:59", )
        Common.updateProduct("PD201811021853258996436--会员稳盈45天", product_status=5, raise_end_time="2018-11-22 19:44:59", )

        for pno in ['ZC201809271047460520250','ZC201809271049131772352','ZC201809271049432913319','ZC201809271052120270080']:
            Common.updateProduct("ZC201811051546261322194", product_status=6, raise_end_time="2018-10-30 19:44:59", )
            Common.updateProduct(pno, product_status=5, raise_end_time="2018-11-30 19:44:59", )
            Common.dumpProduct(pno)




    def tearDown(self):
        print("Test_001 tearDown")
